<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category   design_default
 * @package    Mage
 * @copyright  Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
 * @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */

/**
 * Product view template
 *
 * @see Mage_Catalog_Block_Product_View
 */
?>
<script type="text/javascript">
    var optionsPrice = new Product.OptionsPrice(<?php echo $this->getJsonConfig() ?>);
</script>
<div id="messages_product_view"><?php echo $this->getMessagesBlock()->getGroupedHtml() ?></div>
<?php $_product=$this->getProduct() ?>
<form action="<?php echo $this->getAddToCartUrl($_product) ?>" method="post" id="product_addtocart_form">
<div class="product-info-box">
    <div class="product-essential">
        <div class="product-shop">
            <div class="col2-alt-set">
                <div class="col-1">
                    <div class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(85, 85); ?>" width="85" height="85" alt="<?php echo $this->htmlEscape($_product->getName()) ?>" /></div>
                    <?php if($_product->isSaleable()): ?>
                        <?php if ($this->helper('wishlist')->isAllow()) : ?>
                            <div style="padding:7px 0 5px 8px;"><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>"><?php echo $this->__('Add to Wishlist') ?></a></div>
                        <?php endif; ?>
                    <?php endif; ?>
                    <?php if ($this->canEmailToFriend()): ?>
                        <div style="padding:0 0 5px 6px;"><a href="<?php echo $this->helper('catalog/product')->getEmailToFriendUrl($_product) ?>"><?php echo $this->__('Email to a Friend') ?></a></div>
                    <?php endif; ?>
                </div>
                <div class="col-2">
                    <h3 class="product-name"><?php echo $this->htmlEscape($_product->getName()) ?></h3>
                    <?php echo $this->getChildHtml('product_type_data') ?>

                    <fieldset class="no-display">
                        <input type="hidden" name="product" value="<?php echo $_product->getId() ?>" />
                        <input type="hidden" name="related_product" id="related-products-field" value="" />
                    </fieldset>

                    <script type="text/javascript">
                        var productAddToCartForm = new VarienForm('product_addtocart_form');
                        productAddToCartForm.submit = function(){
                                if (this.validator.validate()) {
                                        this.form.submit();
                                }
                        }.bind(productAddToCartForm);
                    </script>
                    <div class="clear"></div>

                   <?php echo $this->getChildHtml('tierprices') ?>

                   <?php if (!$this->hasOptions()):?>
                        <?php if($_product->isSaleable()): ?>
                            <?php echo $this->getChildHtml('addtocart') ?>
                        <?php endif; ?>
                    <?php endif; ?>

                    <?php echo $this->getChildHtml('other');?>

                    <?php if ($_product->isSaleable() && $this->hasOptions()):?>
                        <?php echo $this->getChildChildHtml('container1', '', true, true) ?>
                    <?php endif;?>
                </div>
                <div class="clear"></div>
            </div>
        </div>
            <?php if ($_product->isSaleable() && $this->hasOptions()):?>
                <?php echo $this->getChildChildHtml('container2', '', true, true) ?>
            <?php endif;?>
        </div>

        <div class="product-collateral">
        <?php if ($_description = $this->getChildHtml('description')):?>
            <br />
            <h4><?php echo $this->__('Product Description') ?></h4>
            <div class="product-specs">
                <?php echo $_description ?>
            </div>
        <?php endif; ?>

        <?php if($_additional = $this->getAdditionalData()): ?>
        <div class="attribute-specs">
            <h4><?php echo $this->__('Additional Information') ?></h4>
            <table cellspacing="0" class="data-table" id="product-attribute-specs-table">
                <?php foreach ($_additional as $_data): ?>
                <tr>
                    <td class="label"><?php echo $_data['label'] ?></td>
                    <td class="data"><?php echo $_data['value'] ?></td>
                </tr>
                <?php endforeach; ?>
            </table>
            <script type="text/javascript">decorateTable('product-attribute-specs-table')</script>
        </div>
        <?php endif; ?>

        <?php echo $this->getChildHtml('upsell_products') ?>
        <?php echo $this->getChildHtml('product_additional_data') ?>
    </div>
</div>
</form>
